<div class="container main" ng-controller="InvoiceListCtrl">
    <!-- 顶部功能区 -->
    <div class="row">
        <div class="panel panel-default">
            <!-- Default panel contents -->
            <div class="panel-heading">
                 <div class="text-center"><strong>{[moduleTitle|uppercase]}</strong></div>
                <div class="row">
                    <div class="col-md-4">
                        <span class="btn-group">
                            <button data-toggle="dropdown" class="btn btn-default dropdown-toggle">
                                <strong>Actions</strong>&nbsp;&nbsp;<i class="caret"></i>
                            </button>

                            <ul class="dropdown-menu">
                                <li>
                                    <a ng-click="removeSelectedList(objects, query)" href="javascript:void(0);">Delete</a>
                                </li>
                                <li class="divider"></li>
                                <li>
                                    <a onclick="" href="javascript:void(0);">Import</a>
                                </li>
                                <li>
                                    <a onclick="" href="javascript:void(0);">Export</a>
                                </li>
                            </ul>

                        </span>

                        <span class="btn-group">
                            <button class="btn btn-primary pull-left" ng-click="addNew()">
                                <i class="glyphicon glyphicon-plus icon-white"></i> Add
                            </button>
                        </span>
                    </div>
                    <div class="col-md-8">
                        <form name="form_query" ng-submit="query()" class="form-inline pull-right">
                            <div class="form-group">
                                <label class="sr-only"></label>
                                <input type="text" class="form-control" ng-model="parameters.query" placeholder="Keywords" />
                            </div>
                            <div class="form-group">
                                <label class="sr-only"></label>
                                <select class="form-control" name="limit" ng-model="parameters.limit">
                                    <option value="20">20</option>
                                    <option value="30">30</option>
                                    <option value="50">50</option>
                                    <option value="100">100</option>
                                    <option value="0">Unlimited</option>
                                </select>
                            </div>
                            <button type="submit" class="btn btn-info">
                                <i class="glyphicon glyphicon-search icon-white"></i> Search
                            </button>
                        </form>
                    </div>
                </div>
            </div>

            <!-- Table -->
            <div ng-show="objects.length == 0" class="rounded_corners no_result">
                <p>No Invoice found. <a href="javascript:void(0)" ng-click="addNew()">Create Invoice</a> </p>
            </div>
            <table class="table table-striped table-bordered table-condensed table-hover" ng-show="objects.length > 0" ts-wrapper>
                <thead>
                    <tr>
                        <th>
                            <select-all-checkbox checkboxes="objects" all-selected="AllSelectedItems"
                            all-clear="NoSelectedItems"></select-all-checkbox>
                        </th>
                        <th ts-criteria="slug">#</th>
                        <th ts-criteria="sales_order_title">Order Confirmation</th>
                        <th ts-criteria="status_title">Status</th>
                        <th ts-criteria="total">Total($)</th>
                        <th ts-criteria="paymentTotal">Paid($)</th>
                        <th ts-criteria="total">Created At</th>
                        <th ts-criteria="created_on">Assigned To</th>
                        <th></th>
                    </tr>
                </thead>
                <tbody>
                    <tr ng-repeat="obj in objects" ts-repeat="ts-repeat">
                        <td class="text-center">
                            <input type="checkbox" ng-model="obj.isSelected" />
                        </td>
                        <td class="text-center">
                            <a href="javascript:void(0)" ng-click="openInvoiceDetail(obj.id)">{[ obj.slug ]}</a>
                        </td>
                        <td class="text-center">{[ obj.sales_order_title ]}</td>
                        <td class="text-center">{[ obj.status_title ]}</td>
                        <td class="text-center">{[ obj.total ]}</td>
                        <td class="text-center">{[ obj.paymentTotal|number:2 ]}</td>
                        <td class="text-center">{[ obj.created_on | fixDateTime ]}</td>
                        <td class="text-center">{[ obj.assigned_to_title ]}</td>
                        <td>
                            <div class="pull-left" ng-show="obj.payStatus=='Paid'">
                                <i class="pull-left fa fa-money  btn-success" title="Paid"></i>
                            </div>
                            <a class="btn btn-xs" href="/pdf?type=invoice&amp;id={[ obj.id ]}" target="_blank">PDF</a>

                            <span class="btn-group">
                                <button data-toggle="dropdown" class="btn btn-primary btn-xs dropdown-toggle">
                                    <strong>Actions</strong>&nbsp;&nbsp;<i class="caret"></i>
                                </button>
                                <ul class="dropdown-menu dropdown-menu-1">
                                    <li class="text-left">
                                        <a ng-click="edit(obj.id)" href="javascript:void(0);">Edit</a>
                                    </li>
                                    <li class="text-left">
                                        <a ng-click="payment(obj.id)" href="javascript:void(0);">Payment</a>
                                    </li>
                                    <li class="text-left">
                                        <a ng-click="getMoreInfo('invoice',obj.id)" href="javascript:void(0);">More Info</a>
                                    </li>
                                </ul>
                            </span>
                        </td>
                    </tr>
                </tbody>
            </table>
        </div>
    </div>
    <div ng-include="'/static/js/views/components/pager.html'" style="display: inline;"></div>

</div>